/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core;

import java.util.ArrayList;

/**
 *
 * @author victor
 */
public class Setting {
    private static ArrayList<Setting> settings;
    //private int priority;
    private String param1;
    private String param2;
    private Actions type;
    private boolean enabledByDefault;
    static{
        settings=new ArrayList<Setting>();
    }
    public Setting(final Actions type,final String param1,final String param2,final boolean enabledByDefault){
        this.type=type;
        if(param1.equals("")) this.param1=null;
        else this.param1=param1;
        if(param2.equals("")) this.param2=null;
        else this.param2=param2;
        this.enabledByDefault=enabledByDefault;
        addSetting(this);
        //this.priority=priority;
    }
    public Setting(final Actions type,final String param1,final String param2){
        this(type,param1,param2,true);
    }
    private static void addSetting(Setting s){
        settings.add(s);
    }
    public static Setting[] getSettingsByPriority(){
        Setting[] settingsToReturn=new Setting[settings.size()];
        settingsToReturn=settings.toArray(settingsToReturn);
        return settingsToReturn;
    }
    @Override
    public String toString(){
        return Actions.getActionDone(this);
    }
    //public int getPriority(){
        //return priority;
    //}
    public Actions getType(){
        return type;
    }
    public String getParam2(){
        return param2;
    }
    public String getParam1(){
        return param1;
    }
    public void setTag(String tag){
        this.param1=tag;
    }
    public void setAttribute(String attribute){
        this.param2=attribute;
    }
    public boolean getDefaultState(){
        return enabledByDefault;
    }
    public void setDefaultState(boolean state){
        enabledByDefault=state;
    }
}
